<?php
defined('_JEXEC') or die('Restricted access');
/**
 * @version      1.0.15.1 qcalc $
 * @package      qcalc
 * @copyright   Copyright © 2012 - All rights reserved.
 * @license      GNU/GPL
 * @author      Alexander Snitko
 * @author mail   a.lottis@gmail.com
 * @website      www.yoga-life.com.ua
 *
 */
   //$c_name=($this->data);
    
    
$document = JFactory::getDocument();
$document->addScript('./components/com_qcalc/assets/javascript/myscripts.js');
$document->addScript('./components/com_qcalc/assets/javascript/jquery.liveFilter.js');
$user =& JFactory::getUser();
if($user->guest == 0) $kabinet = "private";
else $kabinet = "public";

?>
<ul class="statement_block container-prv">
<h1>Каталог компаний перевозчиков</h1>   
   <ul id="catalog" class="calc_block">
      <li>
         <div>
            <!--noindex-->
            <table class="toggler" style="border-spacing:0;">
               <tbody>
                  <tr>
                     <td style="padding:0;">Сортировать:</td>
                     <td><a href="<?=$kabinet;?>?view=catalog&sort=abc"    class="inactive">по алфавиту</a>&nbsp;</td>
                     <td><a href="<?=$kabinet;?>?view=catalog&sort=uslugi" class="inactive" rel="nofolow">по услугам</a>&nbsp;</td>
                     <td><a href="<?=$kabinet;?>?view=catalog&sort=gorod"  class="inactive" rel="nofolow">по городам</a>&nbsp;</td>
                     <td><a href="<?=$kabinet;?>?view=catalog&sort=strana" class="inactive" rel="nofolow">по странам</a>&nbsp;</td>
                     <td><a href="<?=$kabinet;?>?view=catalog&sort=rating" class="inactive" rel="nofolow">по рейтингу</a>&nbsp;</td>
                  </tr>
               </tbody>
            </table>
            <!--/noindex-->           
         </div>
      </li>
<? if ($this->order == "abc" || $this->order == "rating") { ?>
        
         <ul id="" class="notop container">
            <li>
               <div id="search">
                  <input type="text" class="filter" name="livefilter" placeholder="Введите значение" />
               </div>
            </li>
        </ul>
      
<table class="live_filter" border=0 width="100%">
<?php   
    foreach ($this->data  as $key=>$val) {
        $key = $key+1; $val; 
        echo '<tr><td><a href=/'.$kabinet.'?task=detail&company='.$val->company_id.'>'.$val->company_name.'</a></td><td width="100px;">'."
         <div class=\"stars\" style=\"width:". (ceil(($val->rang/5)*80)) ."px;\"><img src=\"components/com_qcalc/assets/images/transparent.png\" border=0 width=\"100%\" height=\"100%\" alt=\"Оценка: ".$val->rang.", Кол-во голсов: ".$val->rang_num."\" title=\"Оценка: ".$val->rang.", Кол-во голсов: ".$val->rang_num."\"></div>
      </td></tr>";
    }
?>   
</table>

<script type="text/javascript">
      jQuery(document).ready(function() {
         jQuery('table.live_filter').liveFilter('fade');
      });
</script>

<? 
} else if ($this->order == "uslugi" || $this->order == "gorod" || $this->order == "strana" ) { 
   echo "<br><ul class='ordered_list'>";
   $param = null;
   $i = 0;
   foreach ($this->data  as $key=>$val) {
      if ($param != $val->param_id) {
         if ($key >0) echo "</ul></li>";
         if ( $i > 7 ) { echo "</ul><ul class='ordered_list'>"; $i=0; } // ДЕЛИМ НА ДВЕ КОЛОНКИ !!!!!!!!!!!
         echo "<li onClick='jQuery(\"#ul_param_{$val->param_id}\").toggle();'><span>".$val->param_name."</span><ul id='ul_param_{$val->param_id}' style='display:none;'>";
         $param = $val->param_id;
         $i++;
      }
      echo "<li><a href='./private?task=detail&company={$val->company_id}'>{$val->company_name}</a></li>";
   }
   echo "</ul></li></ul>";
} else { ?>
<pre>
<? print_r($this->data); ?>
</pre>
<? } ?>

</ul>

<style>
ul.ordered_list li span{
	border-bottom: 1px dashed;
}
UL.ordered_list {
   width: 270px;
   float: left;
}
UL.ordered_list LI {
   font-size: 14px;
   cursor: pointer;
   margin: 10px 5px 5px 0

}
UL.ordered_list UL {
   margin-left: 20px;
}
UL.ordered_list UL LI {
   font-weight: normal;
   margin: 1px;
}

</style>




